package cn.edu.huanu.service.impl;

import cn.edu.huanu.dao.AddressDao;
import cn.edu.huanu.dao.impl.AddressDaoImpl;
import cn.edu.huanu.exception.BusinessException;
import cn.edu.huanu.pojo.Address;
import cn.edu.huanu.pojo.Cart;
import cn.edu.huanu.service.OrderServcie;
import cn.edu.huanu.utils.R;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author hb
 * @date 2025-11-20 13:01:51
 */
public class OrderServiceImpl implements OrderServcie {
    private AddressDao addressDao =new AddressDaoImpl();
    @Override
    public R loadOrderDatas(Integer uid, Cart cart) throws BusinessException {
        List<Address> addresses = addressDao.queryAddressByUid(uid);
        Map<String,Object> maps =new HashMap<>();
        if(addresses.size()>0){
            maps.put("address",addresses);
        }
        maps.put("cart",cart);

        R r=new R();
        r.success().setData(maps);
        return r;
    }
}
